import axios from "axios";

function request (options){
    const baseURL = {
        production: '/',
        development: 'http://localhost:9080'
      }[process.env.NODE_ENV]

    const headers = {'X-Requested-With': 'XMLHttpRequest'}
    return axios({
        ...options,
        baseURL,
        headers,
        timeout: 1000,
    })
}

export const get = url => request({
    method:"get",
    url
})
export const post = ({url, data}) => request({
    method:"get",
    url,
    data
})